I'm wondering if anyone knows of an easy way to have the trace column contents appear in the order the linked items appear in the link source rather than by their absolute number. In other words, I need to display the object text from a child module, namely the steps of a test protocol, in a trace column. However, DOORS defaults to sorting the displayed trace based on the absolute number rather than the order of the objects in the module or the order in which the links were created..
|
Re: Unsorted Trace Column
You can modify the wizard code, to put the results in a string based skip list with object number as the key. The skip list will sort them by their position in the module.
// DXL generated by DOORS traceability wizard on 10 April 2010.
// Wizard version 2.0, DOORS version 8.2.0.0
pragma runLim, 0
void showOut(Object o, int depth) {
Link l
LinkRef lr
ModName_ otherMod = null
Module linkMod = null
ModuleVersion otherVersion = null
Object othero
string disp = null
string s = null
string plain, plainDisp
int plainTextLen
int count
bool doneOne = false
string linkModName = "*"
// create a string based skip list
Skip result = createString()
for l in all(o->linkModName) do {
otherVersion = targetVersion l
otherMod = module(otherVersion)
if (null otherMod || isDeleted otherMod) continue
othero = target l
if (null othero) {
load(otherVersion,false)
}
othero = target l
if (null othero) continue
if (isDeleted othero) continue
doneOne = true
if (depth == 1) {
// modified instead of displayRich ...
s = (identifier othero)
// put the result in there first
put (result , number othero, s)
}
}
// now display them
for plain in result do { display plain }
delete result
}
showOut(obj,1)
|
Re: Unsorted Trace Column Mathias Mamsch - Fri Apr 09 20:24:55 EDT 2010
You can modify the wizard code, to put the results in a string based skip list with object number as the key. The skip list will sort them by their position in the module.
// DXL generated by DOORS traceability wizard on 10 April 2010.
// Wizard version 2.0, DOORS version 8.2.0.0
pragma runLim, 0
void showOut(Object o, int depth) {
Link l
LinkRef lr
ModName_ otherMod = null
Module linkMod = null
ModuleVersion otherVersion = null
Object othero
string disp = null
string s = null
string plain, plainDisp
int plainTextLen
int count
bool doneOne = false
string linkModName = "*"
// create a string based skip list
Skip result = createString()
for l in all(o->linkModName) do {
otherVersion = targetVersion l
otherMod = module(otherVersion)
if (null otherMod || isDeleted otherMod) continue
othero = target l
if (null othero) {
load(otherVersion,false)
}
othero = target l
if (null othero) continue
if (isDeleted othero) continue
doneOne = true
if (depth == 1) {
// modified instead of displayRich ...
s = (identifier othero)
// put the result in there first
put (result , number othero, s)
}
}
// now display them
for plain in result do { display plain }
delete result
}
showOut(obj,1)
You want: 3.2.1 3.2.2 ... 3.2.9 3.2.10 You get: 3.2.1 3.2.10 3.2.2 ... 3.2.9 Perhaps store results based on Key 'Object'. At the bottom, issue a "for obj in targetModule do" loop, and if that object has a value in the Skip then display it.
PS To get Paragraph Numbers to sort, you must pad the parts with zeros: 3.2.2 becomes perhaps 0003.0002.0002, which will sort, then un-pad them. Been-there-done-that, Yuuuuck. Similar problem sorting on string "Object Identifier", where "XYZ_300" sorts before "XYZ_40". Can pad, or convert to Integer and sort that. |
Re: Unsorted Trace Column llandale - Sun Apr 11 17:54:18 EDT 2010
PS To get Paragraph Numbers to sort, you must pad the parts with zeros: 3.2.2 becomes perhaps 0003.0002.0002, which will sort, then un-pad them. Been-there-done-that, Yuuuuck. Similar problem sorting on string "Object Identifier", where "XYZ_300" sorts before "XYZ_40". Can pad, or convert to Integer and sort that.
Argh ... I knew that could be to easy to be true :-) I have some experimental code, which will install a global variable from the DXL layout, which it uses to cache the results. But thats probably overkill, padded object numbers would probably be more reasonable (see code below, that I hope works correctly :-))
string padObject (string val, int PADCOUNT) {
int nl = length val; int p = 0; int c = 0;
Buffer n = create(); n = val;
n += '.'
Buffer result = create()
while (p <= nl) {
if (n[p] == '.' || n[p] == '-' || p == nl) {
if (PADCOUNT-p+c > 0) for j in 0:(PADCOUNT-p+c)-1 do result+='0';
combine (result, n, c, p-1);
if (p < nl) result += n[p];
c = p + 1; p+=2
} else p++
}
string res = stringOf result
delete result; delete n
return res
}
string padObject (string val) { return padObject (val, 5) }
print "Result:" (padObject "1.1") "\n"
print "Result:" (padObject "1.10-5") "\n"
print "Result:" (padObject "10.1.1-800") "\n"
|